<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="_csrf" th:content="${_csrf.token}"/>
    <meta name="_csrf_header" th:content="${_csrf.headerName}"/>
    <title>闲言作者推荐</title>
    <link th:include="fragment/import :: import">
</head>
<body id="articleData">
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title">
        <li class="layui-this" id="unPassedAuthor">
            作者列表
        </li>
        <li id="passedAuthor">
            已推荐的作者
        </li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show" data-id="1">
            <!--未推荐的-->
            <table class="layui-hide" id="test" lay-filter="test"></table>

        </div>
        <div class="layui-tab-item" data-id="2">
            <!--已推荐的-->
            <table class="layui-hide" id="passRecommend" lay-filter="test"></table>
        </div>
    </div>
</div>
</body>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="commend">推荐</a>
</script>
<script type="text/html" id="recommendBar">
    <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="cancelRecommend">取消推荐</a>
</script>

<script>
    layui.config({
        base: '../../static/js/admin/recommend/'
    }).extend({ //设定模块别名
        pass: 'authorRecommend' //如果 mymod.js 是在根目录，也可以不用设定别名
    }).use('authorRecommend');
</script>
<script type="text/javascript" th:inline="none">
    layui.use('table', function(){
        var table = layui.table;
        /*已推荐的列表*/
        table.render({
            elem: '#test'
            ,url:'/admin/AuthorRecommend/AuthorRecommendList/YES'
            ,cellMinWidth: 60 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,page: true
            , request: {
                pageName: 'pageNumber' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            ,cols: [[
                {field:'recommendedTime',  title: '推荐时间', sort: true}
                ,{field:'article', title: '作者名'}
                ,{field:'recommendedReason', title: '推荐理由'}
                ,{fixed: 'right',title:'操作' ,align:'center', toolbar: '#barDemo'}
            ]]
        });

        /*已推荐的列表*/
        table.render({
            elem: '#passRecommend'
            ,url:'/admin/recommend/articleRecommendList'
            ,cellMinWidth: 60 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,page: true
            , request: {
                pageName: 'pageNumber' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
            }
            ,cols: [[
                {field:'recommendedTime',  title: '推荐时间', sort: true}
                ,{field:'article', title: '标题',templet:'<div>{{d.article.title}}</div>'}
                ,{field:'article', title: '作者',templet:'<div>{{d.article.witter}}</div>'}
                ,{field:'recommendedReason', title: '推荐理由'}
                ,{field:'indexShowImageUrl', title: '展示图片地址'}
                ,{fixed: 'right',title:'操作' ,align:'center', toolbar: '#recommendBar'}
            ]]

        });

    });
</script>
</html>